// 元素获取
var box_dl = document.getElementById("box-dl");
var user_ele = document.getElementById("inputUsr");
var pass_ele = document.getElementById("inputPassword");
var tishi_ele = document.getElementById("tishi");
box_dl.onclick = function () {
    // 获取输入框内容
    var user_value = user_ele.value;
    var pass_value = pass_ele.value;

    var url = "http://localhost:3000/dl"
    var data = {
        username: user_value,
        password: pass_value
    }
    xhrGet(url, data).then(
        function (res) {
            // 把php反馈的数据转为数组或对象
            var res = JSON.parse(res);
            if (res.state === "success") {
                // php中没有问题跳转
                location.assign("../html/index.html")
            } else if (res.state === "error") {
                tishi_ele.style.display = "block";
                tishi_ele.innerHTML = res.msg;
                setTimeout(function () {
                    tishi_ele.style.display = "none";
                }, 1500)
            }
        }
    )
}